import axios from "axios";
import store from "@/store"
// import { config } from "vue/types/umd";

axios.defaults.baseURL = "http://121.89.205.189:3001";

//发送请求拦截，一般是携带token头
axios.interceptors.request.use((config)=>{
    if(localStorage.getItem("token")){
        config.headers.token  = localStorage.getItem("token")
    }
    store.commit("changeIsshow",true)
    return config
})
axios.interceptors.response.use(function(res){    
    // 处理loading（把loading隐藏）
    store.commit("changeIsshow",false);
    return res;

});

// 导出
export default axios;